package com.heima.model.threadlocal;

import com.heima.model.wemedia.pojos.WmUser;

public class WmThreadLocalUtils {
    private static final ThreadLocal<WmUser> userThreadLocal = new ThreadLocal<>();

    //设置当前线程的用户信息
    public static void setUser(WmUser wmUser){
        userThreadLocal.set(wmUser);
    }
    //获取当前线程的用户信息
    public static WmUser getUser(){
        return userThreadLocal.get();
    }
    //删除线程中的用户信息
    public static void clear(){
        userThreadLocal.remove();
    }
}
